<script setup>
const router = useRouter()
const route = useRoute()

const back = history.state.back

if (history.state.from === 'permission-guard') {
  delete history.state.from
}
else if (route.query.path) {
  router.replace(route.query.path)
}
</script>

<template>
  <CommonPage :show-header="false">
    <div class="wh-full flex">
      <el-result
        icon="warning"
        class="m-auto"
        title="403 禁止访问"
        sub-title="抱歉，您暂无权限访问，请联系管理员开通权限。"
      >
        <template #extra>
          <el-button
            v-if="back"
            type="primary"
            ghost
            @click="router.replace(back)"
          >
            返回上一页
          </el-button>
          <el-button type="primary" class="ml-20" @click="router.replace('/')">
            返回首页
          </el-button>
        </template>
      </el-result>
    </div>
  </CommonPage>
</template>
